package cn.zhyjohn.paysystem;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@Slf4j
@SpringBootApplication
@ComponentScan("cn.zhyjohn")
public class PaysystemApplication {

	public static void main(String[] args) throws UnknownHostException {
		ConfigurableApplicationContext run = SpringApplication.run(PaysystemApplication.class, args);
		/**
		 * 快捷启动doc页面访问
		 */
		Environment env = run.getEnvironment();
		String ip = InetAddress.getLocalHost().getHostAddress();
		String port = env.getProperty("server.port");
		String path = env.getProperty("server.servlet.context-path");
		log.info("\n----------------------------------------------------------\n\t" +
				"Application cherrytea is running! Access URLs:\n\t" +
				"Local: \t\thttp://localhost:" + port + path + "/doc.html\n\t" +
				"NetWork: \thttp://" + ip + ":" + port + path + "/doc.html\n\t" +
				"------------------------------------------------------------");
	}

}
